Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create advanced.md Client documentation file #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Create advanced.md Client documentation file #54

wants to merge 1 commit into from

Conversation

drbyte
Copy link
Contributor

@drbyte drbyte commented Jun 19, 2020

Added section on detecting Expose as the active proxy server. This can be useful when taking custom action based on the kind of proxy server being used (such as overriding non-standard routing logic, auto-selecting proxy-specific databases, etc)

Ref:

protected function prepareRequest(Request $request, ControlConnection $controlConnection): Request
{
$request::setTrustedProxies([$controlConnection->socket->remoteAddress, '127.0.0.1'], Request::HEADER_X_FORWARDED_ALL);
$host = $this->configuration->hostname();
if (! $request->isSecure()) {
$host .= ":{$this->configuration->port()}";
}
$request->headers->set('Host', $controlConnection->host);
$request->headers->set('X-Forwarded-Proto', $request->isSecure() ? 'https' : 'http');
$request->headers->set('X-Expose-Request-ID', uniqid());
$request->headers->set('Upgrade-Insecure-Requests', 1);
$request->headers->set('X-Exposed-By', config('app.name').' '.config('app.version'));
$request->headers->set('X-Original-Host', "{$controlConnection->subdomain}.{$host}");
return $request;
}

Added section on detecting Expose as the active proxy server. This can be useful when taking custom action based on the kind of proxy server being used (such as overriding non-standard routing logic, auto-selecting proxy-specific databases, etc)

Ref: https://github.com/beyondcode/expose/blob/d98eabe36e9c19c42f3b8f44601a2a457cb3af26/app/Server/Http/Controllers/TunnelMessageController.php#L106-L124
@drbyte
Copy link
Contributor Author

drbyte commented Jun 19, 2020

While I haven't studied it fully to be sure, can the client use a project-specific .expose.php file for config overrides, similar to how the Server can? If so, I envision info about that being added to this advanced.md doc as well ... hence creating the new file for this PR instead of combining it into someplace else.

@drbyte drbyte changed the title Create advanced.md Create advanced.md Client documentation file Jun 19, 2020
@mpociot
Copy link
Member

mpociot commented Jun 22, 2020

Yeah, that's right @drbyte. Expose will look in two different locations for the config file:

First in the current working directory as .expose.php and then in ~/.expose/config.php.
So yeah, project-specific expose configuration is possible - but yet undocumented.

I'll leave this PR open and would add the changes myself and then add this file to the navigation as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants